﻿/**
 * @file guild_application_logic.h
 * @date 2021/05/24 20:05
 *
 * @author harrybao (harrybao@123u.com)
 *
 * @brief 公会申请逻辑
 *
 * @version v1.0.0
 *
 * @copyright Copyright © 2021 All Rights Reserved 上海欢乐互娱网络科技有限公司
 *
 * @par history:
 * <table>
 * <tr><th>Date                     <th>Version     <th>Author <th>Description
 * <tr><td>2021/05/24 20:05         <td>1.0.0       <td>harrybao
 * <td>创建初始版本
 * </table>
 */

#pragma once

#include "error/error_code.h"
#include "guild/guild.h"

namespace guildservicebasic_cpp {
enum class RoleSex : int;
}  // namespace guildservicebasic_cpp

struct GuildModuleApplication;

namespace guild_service {

/**
 * @brief 公会申请逻辑类
 *
 */
class GuildApplicationLogic {
 public:
//   /**
//    * @brief 获取公会申请模块
//    * @param guild
//    * @param priority
//    * @return
//    */
//   static GuildApplication* GetGuildApplication(
//       const Guild& guild, const GetModulePriority priority =
//                               GetModulePriority::GET_MODULE_PRI_USE_CACHE);

  /**
   * @brief Get the Guild Module Application object
   * 
   * @param guild_id 
   * @param module_application 
   * @return true 
   * @return false 
   */
  static bool GetGuildModuleApplication(const guild_id_type guild_id,
                                        GuildModuleApplication& module_application);

 public:
  /**
   * @brief 申请加入公会
   * @param role_uuid
   * @param guild_id
   * @param role_sex
   * @param ec
   * @return
   */
  static bool ApplyJoinGuild(const role_uuid_type role_uuid,
                             const guild_id_type guild_id,
                             const guildservicebasic_cpp::RoleSex role_sex,
                             error_code& ec);

  /**
   * @brief 同意加入公会
   * @param role_uuid
   * @param apply_role_uuid
   * @param ec
   * @return
   */
  static bool ApproveJoinGuild(const role_uuid_type role_uuid,
                               const role_uuid_type apply_role_uuid,
                               error_code& ec);
};

}  // namespace guild_service